package com.dongge.Entity;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created by zhudong on 2016/10/7.
 */
public interface UserMapperI {
    //使用@Insert注解指明add方法要执行的SQL
    @Insert("insert into user(name, age) values(#{name}, #{age})")
     int add(User user);

    //使用@Delete注解指明delete方法要执行的SQL
    @Delete("delete from user where id=#{id}")
     int delete(int id);

    //使用@Update注解指明update方法要执行的SQL
    @Update("update user set name=#{name},age=#{age} where id=#{id}")
     int update(User user);

    //使用@Select注解指明getById方法要执行的SQL
    @Select("select * from user where id=#{id}")
     User get(int id);

    //使用@Select注解指明getAll方法要执行的SQL
    @Select("select * from user")
     List<User> getAll();
}
